package com.javafactroy.kunlong.bip.icp.factory;

import com.javafactroy.kunlong.bip.icp.common.consts.IMsgType;
import com.javafactroy.kunlong.bip.icp.factory.iface.IMessageHandler;
import com.javafactroy.kunlong.bip.icp.message.test.base.TMsgResp;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import com.javafactroy.kunlong.bip.icp.message.base.iface.IMessage;

import javax.annotation.PostConstruct;

@Component
@Slf4j
public class TMsgHandler implements IMessageHandler {

    @Override
    public TMsgResp execute(IMessage message) {
        log.info("execute TMsgMessageHandler  default...");
        TMsgResp resp= TMsgResp.buildDefault();
        resp.getHeader().setMessageId(message.getMessageId());
        return resp;
    }
    @PostConstruct

    public void register() {
        log.info("register TMsgMessageHandler ...");
        AppMessageFactory.getInst().registerHandler(IMsgType.MSGTYPE_TMSG_DEFAULT, new TMsgHandler());

    }


}